package com.jsyl.lwbk.web.controller.education;

import com.jsyl.lwbk.business.domain.Question;
import com.jsyl.lwbk.business.dto.education.QuestionListDTO;
import com.jsyl.lwbk.business.service.IQuestionService;
import com.jsyl.lwbk.common.core.controller.BaseController;
import com.jsyl.lwbk.common.core.page.TableDataInfo;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author jh
 * @date 2021-04-02 16:27
 * @desc 题目列表
 **/
@Controller
@RequestMapping("/education/question")
public class QuestionController extends BaseController {

    private String prefix = "education/question";
    @Autowired
    private IQuestionService questionService;

    @RequiresPermissions("education:question:view")
    @GetMapping()
    public String question(ModelMap mmap) {
        return prefix + "/question";
    }



     /**
     * 题目列表
     */
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(QuestionListDTO questionListDTO) {
        startPage();
        List<Question> list = questionService.findList(questionListDTO);
        return getDataTable(list);
    }

    /**
     * 题目列表
     */
    @PostMapping("/listwithoutreporttype")
    @ResponseBody
    public TableDataInfo listwithoutreporttype(QuestionListDTO questionListDTO) {
        startPage();
        List<Question> list = questionService.listwithoutreporttype(questionListDTO);
        return getDataTable(list);
    }
}
